package com.example.serviceheadlines.controller;

import com.example.serviceheadlines.service.IHeadlinesThumpService;
import com.tangyuan.common.result.Result;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @Description: headlines_thump
 * @Author: jeecg-boot
 * @Date: 2024-03-18
 * @Version: V1.0
 */
@Api(tags = "headlines_thump")
@RestController
@RequestMapping("/headlines/headlinesThump")
@Slf4j
public class HeadlinesThumpController {
    @Autowired
    private IHeadlinesThumpService headlinesThumpService;


    /**
     * 百家点赞及取消点赞
     *
     * @param headlinesId
     * @return
     */
    @GetMapping("/addthump")
    public Result addThump(@RequestHeader(name = "userId",required = false) Long userId, @RequestParam("headlinesId") Long headlinesId) {
        return headlinesThumpService.addCommentThumpById(headlinesId, userId);
    }

    /**
     * 百家评论点赞及取消评论点赞
     *
     * @param commentId
     * @return
     */
    @GetMapping("/addCommentThump")
    public Result addCommentThump(@RequestHeader(name = "userId",required = false) Long userId, @RequestParam("commentId") Long commentId) {
        return headlinesThumpService.addCommentThump(commentId, userId);
    }

    /**
     * 百家评论不喜欢及取消不喜欢
     *
     * @param commentId
     * @return
     */
    @GetMapping("/addNoLike")
    public Result<Object> addNoLike(@RequestHeader(name = "userId",required = false) Long userId, @RequestParam("commentId") Long commentId) {
        return headlinesThumpService.addNoLike(commentId, userId);
    }

}
